package pdd;

import java.util.Scanner;

public class Main1 {
    private static int[]numsA;
    private static int[]numsB;
    private static int count=0;
    private static final int BIG= 1000000007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        numsA=convert(sc.nextLine());
        numsB=convert(sc.nextLine());
        cal(0,0,0);
        System.out.println(count);
    }
    private static void cal(int flagA,int flagB,int cur){
        if(cur<0) return;
        if(cur==0 && flagA==numsA.length && flagB==numsB.length){
            count++;
            if(count>=BIG){
                count%=BIG;
            }
            return;
        }
        if(flagA<numsA.length ){
            cal(flagA+1,flagB,cur+numsA[flagA]);
        }
        if(flagB<numsB.length ){
            cal(flagA,flagB+1,cur+numsB[flagB]);
        }

    }
    private static int[] convert(String str){
        int[] ans=new int[str.length()];
        for (int i = 0; i < ans.length; i++) {
            if(str.charAt(i)=='('){
                ans[i]=1;
            }else {
                ans[i]=-1;
            }
        }
        return ans;
    }
}
/*
(()
())
 */